#!/bin/bash
echo "开始安装 tomcat-8.0"
JDK_INSTALL_PATH="/data/soft/tomcat"
JDK_TAR_FILE="apache-tomcat-8.0.24.tar.gz"
JDK_FILE="apache-tomcat-8.0.24"

if [ ! -d "$JDK_INSTALL_PATH" ] ; then
	echo "安装目录不存在，创建安装目录[$JDK_INSTALL_PATH]"
	mkdir -p $JDK_INSTALL_PATH
fi
if [ ! -f "$JDK_TAR_FILE" ] ; then
	echo "TOMCAT安装包不存在，开始下载安装包"
	wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://mirrors.cnnic.cn/apache/tomcat/tomcat-8/v8.0.24/bin/apache-
tomcat-8.0.24.tar.gz
	echo "TOMCAT安装包下载完成"
	cp ./$JDK_TAR_FILE $JDK_INSTALL_PATH
fi
cd $JDK_INSTALL_PATH
if [ -d "$JDK_INSTALL_PATH/$JDK_FILE" ]; then
	echo "删除已存在目录[$JDK_INSTALL_PATH/$JDK_FILE],重新解压缩"
	rm -rf $JDK_INSTALL_PATH/$JDK_FILE
fi
tar -xvf $JDK_TAR_FILE
echo "解压缩安装包完成。。。"


echo "TOMCAT安装完成"